package scala.patternMatching

object BindingNestedVariable {
   def main(args: Array[String]): Unit = {
        
      case object Developer extends Role
      case object Manager extends Role
      
      case class Persion(name:String, age:Int, role:Role)
      val Alice = new Persion("Alice",18,Developer)
      val Bob = new Persion("Bob",20,Manager)
      val John = new Persion("John",30,Manager)
      
      for(item <- Map(1 -> Alice, 2 -> Bob, 3 -> John)){
           item match {
             case (id, p:Persion) => p match {
               case Persion(_,_,Developer) => println(p.name + " : developer")
               case _ => println(p.name + " : is Manager")
             }
             case _ => println("ERROR")
           }
      }
   }
}